<style>
.spotInspection span.error{
    position:absolute     !important;

    left:257px;
}
.up_input {
    position: absolute;
    width:80px;
    opacity:0;
    z-index: 2;
    top: 5px;
    left: 110px;
}
</style>
<form method="post" action="${rc.getContextPath()}/manage/spotInspection/saveSpotInspection"
            class="pageForm required-validate" enctype="multipart/form-data"
            onsubmit="return iframeCallback(this,dialogAjaxDone);">
<div class="pageContent">
    
        <div class="pageFormContent" >
            <input type="hidden" name="navTabId" value="${navTabId!''}">
            <input type="hidden" name="id" value="<#if (spotInspection.id)??>${spotInspection.id!''}</#if>" />
            <input type="hidden" name="pattern" value="${pattern!''}" />
                
            <fieldset>
                <dl class="spotInspection">
                    <dt><@label key="equipmentCode.C,colon">设备编号：</@label></dt>
                    <dd>
                      <input class="required look" id="equipmentLookup.equipmentCode" name="equipmentCode" type="text" postField="equipmentCode" suggestFields="equipmentCode,equipmentText" 
                    suggestUrl="${rc.getContextPath()}/manage/equipment/equipmentSuggest" lookupGroup="equipmentLookup" value="${spotInspection.equipmentCode!''}"
                    warn="<@label key='equipmentCode.C,doesNotExist.C'>设备编号不存在</@label>"  remote="${rc.getContextPath()}/manage/equipment/validateEquipmentCodeForSelect"/>
                    <a class="btnLook" href="${rc.getContextPath()}/manage/equipment/equipmentLookUp" rel="equipmentLookup_dialog" width="700" height="450" lookupGroup="equipmentLookup" title="<@label key='queryEquipment.D'>设备选择</@label>"></a>
                    </dd>
                </dl>
                <dl>
                    <dt><@label key='equipmentText.C,colon'>设备描述：</@label></dt>
                    <dd><input id="equipmentLookup.equipmentText" readonly="readonly" size="22" type="text" maxlength="60" name="equipmentText" value="${spotInspection.equipmentText!''}" />
                    </dd>
                </dl>
               <dl class="spotInspection">
                    <dt><@label key='inspectDateTime.C,colon'>点检时间：</@label></dt>
                    <dd ><input type="text" class="required date"   readonly="readonly" size="17"   name="inspectDateTime" 
                            value="${(spotInspection.inspectDateTime?string('yyyy-MM-dd HH:mm:ss'))?if_exists}" dateFmt="yyyy-MM-dd HH:mm:ss"/>
                            <a class="inputDateButton" href="javascript:;">选择</a>
                    </dd>
                </dl>
                <dl>
                    <dt><@label key='inspectResultFlag.C,colon'>点检结果：</@label></dt>
                    <dd>
                        <select name="inspectResultFlag" class="required">
                            <option value="0"<#if spotInspection.inspectResultFlag?? && spotInspection.inspectResultFlag == 0> selected="selected"</#if>>OK</option>
                            <option value="1"<#if spotInspection.inspectResultFlag?? && spotInspection.inspectResultFlag == 1> selected="selected"</#if>>NG</option>
                        </select>
                    </dd>
                </dl>
                <dl style="width:600px;height:90px;float:left;">
                    <dt><@label key='memo.C,colon'>备注：</@label></dt>
                    <dd>
                        <textarea style="width:435px;position:absolute;left:110px;" name="memo"  maxlength="200" value="${spotInspection.memo!''}" rows="4"><#if (spotInspection.memo)??>${spotInspection.memo!''}</#if></textarea>
                    </dd>
                </dl>
                
            <!--     <dl id="uploadAttachment"  <#if attachmentFile??> style="display:none"</#if> >
                    <dt>上传</dt>
                    <dd>
                        <input name="file" type="file" value="${attachment!''}"/>
                    </dd>    
                </dl>  -->
                
                <dl  id="uploadAttachment" <#if attachmentFile??> style="display:none"<#else> style="width:600px;"</#if> >
                    <dt><@label key='upload.B,colon'>上传：</@label></dt>
                    <dd>
                        <input style="height: 24px; width: 80px;position: absolute;width:80px;opacity:0;z-index: 2;top: 5px;left: 110px;" name="file" type="file" id="import_fileupload"  class="up_input"  value="${attachment!''}"/>
                        <div style="height: 24px; z-index: 1;line-height: 24px; width: 80px;float: left;" id="import_fileupload-button" class="uploadify-button my-uploadify">
                            <span class="uploadify-button-text"><@label key='chooseFile.C'>选择文件</@label></span>
                        </div>
                        <label style="width:355px;" id="fileInput" ></label>
                    </dd>
                </dl>
                <#if attachmentFile??>
                <dl id="attachMentList" style=" margin-top:15px;padding:0;height:50px;width:560px;border-color: #d8dfe5; border-style: solid;border-width: 1px;">
                <table class="table border"  width="100%" id="inspectionAttachMentTable">
                            <thead>
                                <tr>
                                    <th width="100px"><@label key='fileName.C'>文件名称</@label></th>
                                    <th width="100px"><@label key='fileSize.C'>文件大小(bytes)</@label></th>
                                    <th width="50px"><@label key="opera.C">操作</@label></th>
                                </tr>
                            </thead>
                            <tbody>
                                <#if attachmentFile.attachmentCode??>
                                    <tr id="${attachmentFile.attachmentCode!''}" target="file_code" rel="${attachmentFile.fileName!''}">
                                        <td width="100">${attachmentFile.fileName!''}</td>
                                        <td width="100">${attachmentFile.fileSize!''}</td>
                                        <td width="100">
                                        <a title="<@label key='delete.B'>删除</@label>"style="cursor:pointer" target="ajax" class='btnDel' onclick="deleteAttachment('${attachmentFile.attachmentCode}');"></a>
                                        <a class='btnAttach' href="${rc.getContextPath()}/manage/common/downloadAttachement?fileName=${attachmentFile.fileName!''}&attachmentCode=${attachmentFile.attachmentCode!''}"></a>
                                        </td>
                                    </tr>
                                </#if>
                            </tbody>
                        </table>
                </dl>
                </#if>
            </fieldset>
        </div>
        <#if pattern!="add" && spotInspection??>
            <#assign createInfo=spotInspection>
            <#include "/common/createInfo.html">
        </#if>
        <div class="formBar">
            <ul>
                    <li>
                        <div class="buttonActive">
                            <div class="buttonContent">
                                <button type="submit" ><@label key="save.B">保存</@label></button>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="buttonActiveGrey">
                            <div class="buttonContent">
                                    <button type="button" class="close"><@label key="cancel.B">取消</@label></button>
                            </div>
                        </div>
                    </li>
            </ul>
        </div>
    </div>
</form>

<script>

function deleteAttachment(attachmentCode){
    alertMsg.confirm("<@label key='confirmDelAttachment.M'>确定删除此附件吗?</@label>", {
        okCall: function(){
            $.DWZajax({
                url:hostUrl +"/spotInspection/deleteAttachment",
                data:{'attachmentCode':attachmentCode},
                callback:function(data){
                    $("tr#"+attachmentCode).remove();
                    $("#attachMentList").css("display","none");
                    $("#uploadAttachment").css("width","600px");
                    $("#uploadAttachment").css("display","inline");
                }
            });
        }
    });

}
$(function(){
    var $fileUploadButton=$("#import_fileupload",$.pdialog.getCurrent());
    var $fileUploadInput=$("#fileInput",$.pdialog.getCurrent());
    
    $fileUploadButton.change(function(){
        $fileUploadInput.text(document.getElementById("import_fileupload").value);
    });

    
});





</script>